#include <QtGui/QApplication>
#include "wijiwindow.h"
#include <QtDebug>
#include <QtGui/QMainWindow>
#include "scripter.h"
#include "WijiDialog.h"
#include "wijiuiscriptable.h"
#include "WijiSettings.h"
#include "WijiUi.h"
int main(int argc, char *argv[])
{
    const char *name = argv[argc > 1];
    for (const char *str = name; *str; ++str) //strip path before name
        if (*str == '/' || *str == '\\') name = str + 1;
    WijiSettings::appSetup(name);

    QByteArray q_name = WijiSettings::getSelf()->getValue("application_name")
                        .toString().toLocal8Bit();
    char *new_argv[1] = {(char*) q_name.constData()};
    int new_argc = 1;
    QApplication a(new_argc, new_argv);

    QString locale = QLocale::system().name();
    QTranslator translator;
    //translator.load(QString("wiji_") + locale);
    translator.load(QString("wiji_en"));
        a.installTranslator(&translator);

        WijiWindow w;

        w.init();
        w.show();
        WijiUi::getSelf()->afterShow();
    return a.exec();
}

